from time import sleep

import page
from base.base import Base
from tool.get_log import GetLogger

log = GetLogger.get_log()

class PageDemo(Base):

    def page_demo_init(self):
        log.info('正在进行page_demo初始化操作')
        size = self.driver.get_window_size()
        sleep(5)
        self.driver.swipe(size['width'] * 0.5, size['height'] * 0.4, size['width'] * 0.5, size['height'] * 0.9)
        self.base_click_element(page.init_xcx_name)
        self.driver.switch_to.context(self.driver.contexts[-1])

    def page_demo_click_mine(self):
        self.base_click_element(page.fp_mine_tab)

    def page_demo_fp_image_assert(self):
        return self.base_if_element_exist(page.fp_brand_name)

    def page_demo_click_mine_assert(self):
        return self.base_if_element_exist(page.mine_card_package)
